import {
  Column,
  Entity,
  PrimaryGeneratedColumn,
  OneToMany,
  OneToOne,
  ManyToOne,
  JoinColumn,
  BaseEntity,
  CreateDateColumn,
} from 'typeorm';
import { UsersEntity } from '../users/users.entity';

@Entity({ name: 'article' }) //数据表的名字
export class ArticleEntity extends BaseEntity {
  @PrimaryGeneratedColumn() //设置主键和自增
  id: number;

  @Column() //字段及相关限制
  name: string;

  @Column({ type: 'longtext' }) //字段及相关限制
  wenben: string;

  @CreateDateColumn({
    type: 'timestamp',
    name: 'time',
    default: () => 'CURRENT_TIMESTAMP(6)',
    comment: '创建时间',
  })
  time: string;

  @Column({ type: 'int', default: 0 }) //字段及相关限制
  hit: number;
  @Column({ type: 'int', default: null }) //字段及相关限制
  userId: number;
  pls: any;
}
